//
//  MeFileHeadCell.m
//  RainbowFM
//
//  Created by jv on 14-12-7.
//  Copyright (c) 2014年 RB. All rights reserved.
//

#import "MeFileHeadCell.h"
#import <UIImageView+WebCache.h>

@implementation MeFileHeadCell

- (void)awakeFromNib {
    // Initialization code
    
    [self.contentView.superview setClipsToBounds:NO];
    
    [self _initVar];
    [self _initView];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

#pragma mark - init

- (void)_initVar
{
    
    _bgHImage = [UIImage imageNamed:@"me_myfile_cell_bg_n"];
    _bgPImage = [UIImage imageNamed:@"me_myfile_cell_bg_p"];

}

- (void)_initView
{
    
    UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(_headBorderView.width / 2.f, _headBorderView.width / 2.f) radius:_headBorderView.width / 2.f startAngle:-M_PI endAngle:M_PI clockwise:YES];
    CAShapeLayer *layer = [CAShapeLayer layer];
    layer.path = [path CGPath];
    _headBorderView.layer.mask = layer;

    
    path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(_headView.width / 2.f, _headView.width / 2.f) radius:_headView.width / 2.f startAngle:-M_PI endAngle:M_PI clockwise:YES];
    layer = [CAShapeLayer layer];
    layer.path = [path CGPath];
    _headView.layer.mask = layer;

    
#warning todo
    [_headView sd_setImageWithURL:[NSURL URLWithString:@"http://img0.bdstatic.com/img/image/shouye/mntsc2-12893142236.jpg"] placeholderImage:nil];

}

#pragma mark - setter
- (void)setIsFouced:(BOOL)isFouced
{
    _isFouced = isFouced;
    
    if (_isFouced) {
        _bgImageView.image = _bgPImage;
        _nameLabel.textColor = [UIColor whiteColor];
    }else{
        _bgImageView.image = _bgHImage;
        _nameLabel.textColor = [UIColor colorWithRed:0.309804F green:0.309804F blue:0.309804F alpha:1.0F];
    }
    
}

- (void)setHeadImage:(UIImage *)headImage
{
    _headImage = headImage;
    
    _headView.image = _headImage;
}

@end
